home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / QuickTime / Programming Stuff / Sample Code / Music Architecture / Mixed Bag / BigEasy / BigEasyControls.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-11  |  6.8 KB  |  217 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        BigEasyControls.h
  3.  
  4.     Written by:    dvb
  5.  
  6.     Copyright:    © 1990-1991, 1994 by Apple Computer, Inc., all rights reserved.
  7.  
  8.     This file is used in these builds: Warhol
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <7>    11-10-94    dvb        Bold/Style errors
  13.          <6>     4/13/92    dvb        #ifdef for multiple inclusions.
  14.          <5>      4/3/92    dvb        Oh, structure names should start with upper case. What was I
  15.                                     thinking of, anyway?
  16.          <4>     1/20/92    dvb        Latest BigEasy revs.
  17.          <3>    12/19/91    JB        removing think 4.0 code
  18.          <2>     5/28/91    JB        Added prototypes for BigEasy Proc Ptrs
  19.          <3>      8/3/90    dvb        Smarter rectangle changes
  20.          <2>     7/31/90    dvb        Update for control-list-handles
  21.  
  22.     To Do:
  23. */
  24.  
  25. /*
  26.   * file: BigEasyControls.h
  27.   *
  28.   * started 25 May 1990 12:07:24 Friday at 310 Nobel
  29.   * 
  30.   * david van brink
  31.   *
  32.   */
  33.  
  34. #ifndef _BigEasyControls_
  35. #define _BigEasyControls_
  36.  
  37. /************************************
  38. * types
  39. ************************************/
  40.  
  41. /*
  42.   * void NewProc(easyControlPtr ec);
  43.   * void DisposeProc(easyControlPtr ec);
  44.   * void TrackProc(easyControlPtr ec,Point p);
  45.   */
  46.  
  47. typedef void (*becNewProcPtr)(struct easyControlRecord *ec);        
  48. typedef void (*becDisposeProcPtr)(struct easyControlRecord *ec);        
  49. typedef void (*becDrawProcPtr)(struct easyControlRecord *ec);    
  50. typedef void (*becHitTestProcPtr)(struct easyControlRecord *ec,Point p);
  51. typedef void (*becTrackProcPtr)(struct easyControlRecord *ec,Point p,short *result,short mods);    
  52. typedef void (*becKeyProcPtr)(struct easyControlRecord *ec,short key,short mods,Boolean *tookKey);        
  53. typedef void (*becSetValueProcPtr)(struct easyControlRecord *ec,long value);    
  54. typedef void (*becIdleProcPtr)(struct easyControlRecord *ec,long *ref);        
  55. typedef void (*becDrawValueProcPtr)(struct easyControlRecord *ec);        /* Function Pointer */
  56.  
  57. typedef void (*becActionProcPtr)(long value,long refcon);        
  58. typedef void (*becInitActionProcPtr)(long value,long refcon);        
  59. typedef void (*becDoneActionProcPtr)(long value,long refcon);        
  60. typedef void (*becValueProcPtr)(struct easyControlRecord **ec);        
  61.  
  62. typedef struct
  63.     {
  64.     becNewProcPtr newProc;
  65.     becDisposeProcPtr disposeProc;
  66.     becDrawProcPtr drawProc;
  67.     becHitTestProcPtr hitTestProc;
  68.     becTrackProcPtr trackProc;
  69.     becKeyProcPtr keyProc;
  70.     becSetValueProcPtr setValueProc;
  71.     becIdleProcPtr idleProc;
  72.     becDrawValueProcPtr drawValueProc;
  73.     } easyControlType;
  74.  
  75. #ifdef privateEasyControls
  76. /*
  77.   * This should only be included by control manager and controls
  78.   */
  79.  
  80. typedef struct easyControlRecord
  81.     {
  82.     easyControlType *type;
  83.     Rect rect;
  84.     long refcon;
  85.     long id;                /* Sort of another refcon, used to uniquely identify each control */
  86.     long variation;
  87.     long flags;                /* Common states, like "active/inactive"                    */
  88.     long value;            /* Could be a pointer or handle to complex value            */
  89.     void *state;            /* For internal use of the type                            */
  90.     void *style;            /* Shared style information, depending on type                */
  91.     short color[6];            /* Defines the color appearance of the control, in 555 colors    */
  92.     becActionProcPtr actionProc;        /* while dragging                */
  93.     becInitActionProcPtr initActionProc;        /* called once before dragging                */
  94.     becDoneActionProcPtr doneActionProc;        /* called once after dragging                */
  95.     becValueProcPtr valueProc;            /* called when value changes        */
  96.     /* CFP keyProc;            /* to process key presses        */
  97.     long low,high;            /* range of control                */
  98.     struct easyControlRecord **prev;
  99.     struct easyControlRecord **next;
  100.     struct easyControlListRecord **list;
  101.     } easyControlRecord,*easyControlPtr,**easyControl;
  102. /* #define  easyControlPtr easyControlRecord * */
  103.  
  104. enum                                        /* flags field of easyControl */
  105.     {
  106.     easyControlActive = 1,
  107.     easyControlBack = 2,                    /* set when the owner window is background */
  108.     easyControlTracking = 4,                    /* set while the control is tracking */
  109.     easyControlSetValue = 8,                    /* set if redraw is for "setvalue" */
  110.     easyControlMoved = 16            /* set when the control has moved, cleared by cdef */
  111.     };
  112.  
  113. typedef struct easyControlListRecord
  114.     {
  115.     easyControl firstControl;
  116.     easyControl selectedControl;
  117.     easyControl nextSelectedControl;        /* if nothing selected, this may specify what "tab" gets to */
  118.     short textFont;
  119.     short textFace;
  120.     short textSize;
  121.     WindowPtr ownerWindow;                    /* the window these controls are attached to */
  122.     long refcon;                            /* for the application */
  123.     long idleRef;
  124.     long nextIdle;
  125.     long ticksPerIdle;
  126.     long controlCount;
  127.     } easyControlListRecord, *easyControlListPtr, **easyControlList;
  128.  
  129. #else
  130.  
  131. typedef struct {
  132.     long dummy;
  133.     } **easyControl;
  134.  
  135. typedef struct {
  136.     long dummy;
  137.     } **easyControlList;
  138.  
  139. #endif
  140.  
  141.  
  142. typedef struct
  143.     {
  144.     easyControl whichControl;
  145.     Boolean tracked;
  146.     long value;
  147.     long refcon;
  148.     long id;
  149.     } controlClickResult;
  150.  
  151. enum            /* colors in a control */
  152.     {
  153.     controlFrame = 0,
  154.     controlBackground,
  155.     controlPart1,
  156.     controlPart2
  157.     };
  158.  
  159.  
  160. /************************************
  161. * Macros
  162. ************************************/
  163. #define AsFloat(x) ( *((float *)(& x)))            /* interpret a var's bits as if they was floatin' pt */
  164. #define PackColor555(r,g,b) (( (r)>>11<<10) | ( (g)>>11<<5) | ( (b)>>11))
  165.  
  166. #define EasyControl easyControl
  167. #define EasyControlList easyControlList
  168. #define ControlClickResult controlClickResult
  169.  
  170. /************************************
  171. * prototypes
  172. ************************************/
  173.  
  174. easyControlList NewEasyControlList(WindowPtr w, long refcon);
  175. void DisposeEasyControlList(easyControlList list);
  176.  
  177. easyControl NewEasyControl(easyControlType *,Rect *,long variation, 
  178.         void *style,long refcon,long id, long value,easyControlList list);
  179. void DisposeEasyControl(easyControl, easyControlList list);
  180.  
  181. void SetEasyControlRange(easyControl ech,long low,long high);
  182. void SetEasyControlValueProc(easyControl ech, becValueProcPtr valueProc);
  183. void SetEasyControlActionProc(easyControl ech, becActionProcPtr actionProc);
  184. void SetEasyControlInitActionProc(easyControl ech, becInitActionProcPtr initActionProc);
  185. void SetEasyControlDoneActionProc(easyControl ech, becDoneActionProcPtr doneActionProc);
  186.  
  187. void SetEasyControlValue(easyControl ech,long value);
  188. long GetEasyControlValue(easyControl);
  189. long GetEasyControlRefcon(easyControl);
  190. long GetEasyControlID(easyControl);
  191. void GetEasyControlRect(easyControl,Rect *);
  192. void SetEasyControlRect(easyControl,Rect *);
  193.  
  194. void DrawEasyControlList(easyControlList list);
  195. easyControl ClickEasyControlList(easyControlList list,Point p,
  196.         controlClickResult *,short mods);
  197. void KeyEasyControlList(easyControlList list,short key,short mods,controlClickResult *ccr);
  198. void ActivateEasyControlList(easyControlList list);
  199. void DeactivateEasyControlList(easyControlList list);
  200.  
  201. void GetEasyControlColors(easyControl,short *colors);
  202. void SetEasyControlColors(easyControl,short *colors);
  203. void IdleEasyControlList(easyControlList list);
  204.  
  205. void Fore555(short);
  206. void Fore555Light(short);
  207. void Fore555Dark(short);
  208. void Fore555Contrast(short);
  209. unsigned short Replicate555(unsigned short);
  210. void Color555(short,RGBColor *c);
  211.  
  212. void RaisedRect(Rect *r,short x);
  213. void LoweredRect(Rect *r,short x);
  214.  
  215.  
  216. #endif _BigEasyControls_
  217.